﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Shapes;
using KBS8.Shared;

namespace KBS8.Data.GdfDataFilter
{
    public class GdfDataFilter
    {
        /// <summary>
        /// returns an array of FilteredMapData
        /// </summary>
        /// <param name="area">The area which has to be displayed in the application</param>
        /// <param name="zoomLevel">How detailed the map has to be displayed</param>
        /// <returns>An array of FilteredMapData</returns>
        public void GetFilteredMapData(MapTile area, int zoomLevel)
        {
            FilteredOutput output = new FilteredOutput();

            output.Area = area;
            output.ZoomLevel = zoomLevel;

            DatabaseHandler db = new DatabaseHandler();
            ParseHandler ph = new ParseHandler();
            LevelHandler lh = new LevelHandler();

            db.Output = output;
            db.Gate = this;

            db.Successor = ph;
            lh.Successor = ph;
            db.Handle();
        }

        public void ParseData(out AreaFeature[] areaFeatures, out LineFeature[] lineFeatures,
                              out ComplexFeature[] complexFeatures, out PointFeature[] pointFeatures)
        {
            DataManager.GetInstance().ParseData(out areaFeatures, out lineFeatures, out complexFeatures, out pointFeatures);
        }

        /// <summary>
        /// Method to test the module
        /// </summary>
        public void Test()
        {
            MapTile m = new MapTile(2, 2, 1, 1, Color.FromRgb(0, 255, 0));
            Presentation.PresentationManager.GetInstance().GetRoadData(m, 1);
        }
    }
}
